<?php
/**
 * Created by PhpStorm.
 * User: qhzhyt
 * Date: 2018/10/11
 * Time: 0:33
 */

if (!isset($_GET['mapId'])) {
    echo(json_encode(['status' => 0, 'code' => 2]));
    exit(1);
}

if (!isset($_GET['offset'])) {
    $offset = 0;
} else {
    $offset = intval($_GET['offset']);
}

if (!isset($_GET['count'])) {
    $count = 20;
} else {
    $count = intval($_GET['count']);
}


$whereClause = [];

$whereClause['LIMIT'] = [$offset, $count];

$whereClause['ORDER'] = ['take_time' => 'ASC'];

require_once '../conf/conf.php';

$whereClause['map_id'] = $_GET['mapId'];

$whereClause['status'] = 'S';

$recordList = $db->select('play_record', '*', $whereClause);

if (count($recordList) > 0)
    echo(json_encode(['status' => 1, 'code' => 1, 'data' => $recordList]));
else
    echo(json_encode(['status' => 0, 'code' => 5]));
